//:C16:StackTemplate.h
// Simple stack template
#ifndef STACKTEMPLATE_H
#define STACKTEMPLATE_H
#include "../require.h"

template<class T>
class StackTemplate{
    enum { ssize = 100 };
    T stack[ssize];
    int top;
    public:
        StackTemplate() : top(0){}
        void push(const T& i){
            require(top < ssize, "Too many push()es");
            stack[top++] = i;
        }

        T pop(){
            require(top > 0, "Too many pop()s");
            return stack[--top];
        }

        int size() { return top; }
};
#endif
